package com.ch.playandroid.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import com.ch.common.base.viewModel.BaseViewModel
import com.ch.playandroid.bean.Data
import com.ch.playandroid.bean.DataBean
import com.ch.playandroid.repository.ArticleRepository

class AppFragmentViewModel : BaseViewModel() {
    //首页--轮播数据
    val bannerData = ArrayList<Data>()
    fun getBannerData() = ArticleRepository.getBannerData();
    val data = MutableLiveData<Data>()

    //首页--文件列表数据
    private val numberPager = MutableLiveData<Int>();
    val mArticleDataList = ArrayList<DataBean>()
    fun getArticleData() = Transformations.switchMap(numberPager) {
        ArticleRepository.getArticleData(it)
    }

    fun getArticleDataList(pager: Int) {
        numberPager.value = pager
    }


}


